package com.uperform.coach.tdd.domain;

public class NewTaskRequest {
    private String name;
    private String shouldExecuteAt;
    private String cycleTime;

    public NewTaskRequest(String name, String shouldExecuteAt, String cycleTime) {
        this.name = name;
        this.shouldExecuteAt = shouldExecuteAt;
        this.cycleTime = cycleTime;
    }

    public Task toEntity() {
        CycleTime cycleTime = new CycleTime(this.cycleTime);
        return new Task(name, cycleTime.next(shouldExecuteAt), cycleTime);
    }
}
